package com.itheima.dao;

import com.itheima.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {
    @Select("select * from tbl_book")
    List<Book>selectAll();
    @Select("select * from tbl_book where id=#{id}")
    Book selectById(int id);

    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    int add(Book book);

    @Delete("delete from tbl_book where id=#{id}")
    int deleteById(int id);

    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    int update(Book book);
}
